<?php

/**
 * setup for the quext application (example app for the km-library)
 * 
 * override settings in .setup.override.php
 *
 * @author vbolshov
 */

if (is_file(dirname(__FILE__) . '/.setup.override.php'))
{
	include dirname(__FILE__) . '/.setup.override.php';
}

if (empty($settings))
{
	$settings = array();
}

$overriden_settings = $settings;

$settings = array(
	'db' => array(
		'dsn' => 'mysql:dbname=test',
		'username' => 'root',
		'password' => '',
	),
);

$settings = array_merge($settings, $overriden_settings);

require_once dirname(__FILE__) . '/../../lib/Km.php';

use km\db\Select;
use km\db\ActiveRecord;

Km::registerAutoload();

$pdo = new PDO(
	$settings['db']['dsn'], 
	$settings['db']['username'], 
	$settings['db']['password'], 
	array(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)
);
ActiveRecord::setConnection($pdo);

Km::loadLibraryMap(array('quext' => dirname(__FILE__) . '/lib'));